﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class YJLR_YJLRList : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!ProjectPrivate.GetQX("7"))
    {
      Server.Transfer("~\\blank.aspx");
    }
    //if (CWSD.GetSDZT())
    //{
    //  Server.Transfer("~\\sd.aspx");
    //}
    if (!Page.IsPostBack)
    {
      date1.Date = CommonUse.GetYC();
      date2.Date = CommonUse.GetYM();
    }
    BindGrid();
  }

  protected void BindGrid()
  {
    DataSet ds = YJLR.GetDS(date1.Text, date2.Text, SysManage.Get_User);
    ASPxGridView1.DataSource = ds;
    ASPxGridView1.DataBind();
  }

  protected void lbDelete_Command(object sender, CommandEventArgs e)
  {
    string[] s = e.CommandArgument.ToString().Split(new char[] { ',' });
    List<CommandInfo> cis = new List<CommandInfo>();
    cis.Add(CommonUse.DeleteCI("sjlr_yjlr", "yjid", s[0]));

    if (DbHelperSQL.ExecuteSqlTran(cis) > 0)
    {
      BindGrid();
      string nr = "删除履约保证金数据:客户编码为" + s[1] + " 日期为" + s[2] + " 金额为" + s[3];
      rzcz.InsertRZ(nr);
    }
  }

  protected void btnQuery_Click(object sender, EventArgs e)
  {

  }

  protected void btnExport_Click(object sender, EventArgs e)
  {
    this.ASPxGridViewExporter1.WriteXlsToResponse();
  }
}
